﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-title" content="思路广惠">
    <title>推广中心</title>
    
    
    
    <meta content="telephone=no" name="format-detection" />

    
    <link rel="stylesheet" type="text/css" href="../../src/css/base.css?1.0" />
</head>
<body>
    <header class="header">
        <a href="javascript: history.go(-1)" class="head-le"><i class="iconfont icon-fanhui i2m"></i></a>
        <h1 class="header-txt"> </h1>
        <a  class="head-ri" id="newadd">新增</a>
    </header>
    
    <section> 
        <header class="promHe setup-btm"> 
        	<form class="prom-from">
            	<i class="iconfont icon-sousuo"></i> 
                <input type="search" id="searchs" placeholder="输入账号或手机号" />
           </form> 
        </header>
        <div id="promote">
            <p style="margin-top: 50%; text-align: center;">加载中...</p>
        </div> 
    </section> 
    <script type="text/html" class="promotes">
        {{# if(d.length == 0){ }}
            <div class="centre">
                <img style="width: 40vw;height: 40vw; margin-bottom: 1rem;" src="../../src/images/null-huiyuantuiguangweikong.png" />  
                <p class="s13m">暂无推广</p>
            </div>
        {{# }else{ }}
        <ul>
            {{# for(var i = 0; i < d.length; i ++){ }} 
            <li class="flexs-bw pad1rem setup-btm">
            	<div class="flexs">
            		<div class="w25 line-ht">
            			<img class="w100" style="border-radius: 100%;" src="http://image.siluguanghui.com/Image{{d[i].Image_Url}}" />
            		</div> 
                	<div class="pad-lr">
	            		<p class="s13m col3"> {{d[i].Members_Name}} </p>
	            		<p class="huef36 s12m"> 总消费：{{d[i].Members_CashTotal}}元</p>
	            		<p class="flexs top1rem" style="color: #D0D0D0;"> 
	            			{{# if(d[i].Members_ConfirmMark == 0){ }}
	            			<i class="iconfont icon-zhanghu"></i><span class="pad-lr">未认证</span>  
	            			{{# }else{ }}
	            			<i class="iconfont icon-zhanghu huef36"></i><span class="pad-lr">已认证</span>
	            			{{# } }}
	            		</p>
	               
	            	</div>
            	</div>
            	
            	<div class="w25"><i class="iconfont icon-VIPzhang huef36"></i> {{d[i].Level_Name}}</div>
            </li>
            {{# } }}

        </ul>
        <div class="centre promLe-foo pad-ud">已全部展示</div>
        {{# } }}
    </script>
    <script type="text/html" class="promotes">
        {{# if(d.length == 0){ }}
        	<div class="centre">
                <img style="width: 40vw;height: 40vw; margin-bottom: 1rem;" src="../../src/images/null-huiyuantuiguangweikong.png" />  
                <p class="s13m">暂无推广</p>
            </div>
        {{# }else{ }}
        <ul>
            {{# for(var i = 0; i < d.length; i ++){ }} 
            	<li class="flexs-bw pad1rem setup-btm">
            	<div class="flexs">
            		<div class="w25 line-ht">
            			<img class="w100" style="border-radius: 100%;" src="../../src/images/2.png" />
            		</div> 
                	<div class="pad-lr">
	            		<p class="s13m col3"> {{d[i].Business_Name}} </p>
	            		<p class="huef36 s12m"> 总消费：{{d[i].Business_CashTotal}}元</p>
	            		<p class="flexs top1rem" style="color: #D0D0D0;"> 
	            			{{# if(d[i].Business_ConfirmMark == 0){ }}
	            			<i class="iconfont icon-zhanghu"></i><span class="pad-lr">未认证</span>  
	            			{{# }else{ }}
	            			<i class="iconfont icon-zhanghu huef36"></i><span class="pad-lr">已认证</span>
	            			{{# } }}
	            		</p>
	               
	            	</div>
            	</div> 
            	<div class="w25"><i class="iconfont icon-VIPzhang huef36"></i> {{d[i].Level_Name}}</div>
            </li> 
            {{# } }}

        </ul>
        <div class="centre promLe-foo pad-ud">已全部展示</div>
        {{# } }}
    </script>
    <script src="http://apps.bdimg.com/libs/laytpl.js/1.1/laytpl.js"></script>
    <script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="//cdn.bootcss.com/layer/3.0.1/mobile/layer.js"></script>
    <script src="../../src/js/all.js" type="text/javascript" charset="utf-8"></script>
    <script>
            var numhref = silks.getByVal("flag"); 
            // 点击新增
            $("#newadd").attr("href","promotenew.html?flag=" + numhref);
            
            function getPromote(url,ids,ikeVar) { 
            	$.ajax({
            		type: "post",
            		url: urls+url,
            		data: {
	                    MembersID: MembersID,
	                    ikeVar: ikeVar,
	                    PageIndex: 0,
	                    AppID: AppID,
	                    Token: Token
	               	},
	               	success:function (res) {
	                    if (res.Return_ID == 0) {
	                        console.log(res) 
	                        laytpl($(ids).html()).render(res.Return_Data.PageData, function (html) {
	                            $("#promote").html(html); 
	                        });
	                         
	                    }
	                },
	                beforeSend: function(){
	                	 $("#promote").html('<p style="margin-top: 50%; text-align: center;">加载中</p>')
	                }
            	});
            } 
            
            switch (numhref)
            {
                case "0":
                    $(".header-txt").html("会员推广");
                    getPromote("/WorkIntro/GetMembersByIntroducer",".promotes:first","")
                    break;
                case "1":
                    $(".header-txt").html("商家推广");
                    getPromote("/WorkIntro/GetBusinessByIntroducer",".promotes:last","")
                    break;
                default:
                    //没有其他条件
                    break;
            }


            // 点击搜索
            $(document).on('keypress', function (e) {
                var keycode = e.keyCode;
                var searchName = $("#searchs").val();
                 
                if (keycode == '13') {
                    e.preventDefault();
                    switch (numhref) {
                        case "0": 
                            getPromote("/WorkIntro/GetMembersByIntroducer", ".promotes:first", searchName)
                            break;
                        case "1": 
                            getPromote("/WorkIntro/GetBusinessByIntroducer", ".promotes:last", searchName)
                            break;
                        default:
                            //没有其他条件
                            break;
                    }
                }
            }) 
             
            
             
        
    </script>
</body>
</html>